#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

import sys
import time

time1=time.time()

infile = open(sys.argv[1], "r")
outfile = open(sys.argv[1] + ".maxlength", "w")

title = infile.readline()
title = title.rstrip()
splittitle = title.split("\t")
maxlength = []
for i in range(len(splittitle)):
    maxlength.append(0)

for line in infile:
    line = line.rstrip()
    splitline = line.split("\t")
    for i in range(len(splitline)):
        if len(splitline[i]) > maxlength[i]:
            maxlength[i] = len(splitline[i])

for i in range(len(splittitle)):
    outfile.write(splittitle[i] + ":" + str(maxlength[i]) + "\n")
infile.close()

time2=time.time()
timespend=time2-time1

print sys.argv[1]+":"+str(timespend)+"s"




